home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
ts.h.z
/
ts.h
Wrap
Text File
|
1992-04-03
|
10KB
|
315 lines
/**************************************************************************
* *
* Copyright (C) 1986, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ident "$Revision: 1.3 $"
/*
** ts.h
** The file contains the various defines and structures for the
** QIC-02 (ISI) tape controller.
*/
/*
** Types of wait that can used with the tscmd() routine
*/
typedef enum
{
TS_WAIT, TS_NOWAIT, TS_POLL
} tswtype;
/*
** pass or fail return values for tsiomove() and ts_ssrdelay()
*/
typedef enum
{
TS_PASS, TS_FAIL
} tscc;
/*
** Layout of the Controller registers
*/
typedef volatile struct
{
ushort tsr_tcpr; /* Command pointer register: w only */
ushort tsr_txcpr; /* Extended command pointer register: w only*/
ushort tsr_clkreg; /* Clock register: r/w */
ushort tsr_atxcpr; /* Alternate extended command pointer */
/* register: w */
} *tsregs;
/*
** this define remaps the tsr_tcpr, Command Pointer register into correct
** name for the same location when read
*/
#define tsr_tssr tsr_txcpr /* Status register: r only */
/*
** Layout of the command packet
*/
typedef struct
{
ushort tscp_cmd; /* command bits */
ushort tscp_badr_lo; /* low order buffer address */
ushort tscp_badr_hi; /* high order buffer address */
ushort tscp_cnt; /* count */
} tscmdpkt;
/*
** Layout of Message packet
*/
typedef struct
{
ushort tsmp_type; /* Message type info */
ushort tsmp_len; /* Length of message packet */
ushort tsmp_rbpcr; /* Residual count */
ushort tsmp_xs0; /* Extended status register #0 */
ushort tsmp_xs1; /* Extended status register #1 */
ushort tsmp_xs2; /* Extended status register #2 (zero) */
ushort tsmp_xs3; /* Extended status register #3 */
ushort tsmp_pad;
} tsmsgpkt;
typedef struct
{
ushort tsrp_badr_lo; /* low address of message packet */
ushort tsrp_badr_hi; /* high address of message packet */
ushort tsrp_cnt; /* byte size of message packet */
ushort tsrp_modes; /* characteristic info */
} tscrpkt;
typedef volatile tscmdpkt *tscmdpkt_ptr;
typedef volatile tsmsgpkt *tsmsgpkt_ptr;
typedef volatile tscrpkt *tscrpkt_ptr;
/*
** This structure contains the info pertenanit to the controller
*/
typedef struct
{
/* pointer to cmd packet - uncached */
tscmdpkt_ptr tsc_cmdpkt_nc;
/* pointer to msg packet - uncached */
tsmsgpkt_ptr tsc_msgpkt_nc;
/* pointer to characteristics packet - un-cached */
tscrpkt_ptr tsc_crpkt_nc;
tscmdpkt tsc_cmdpkt; /* cmd packet */
tsmsgpkt tsc_msgpkt; /* msg packet */
tscrpkt tsc_crpkt; /* characteristics packet */
tsregs tsc_tsregs; /* pointer to controller registers */
char *tsc_buffer; /* pointer to internal buffer */
int tsc_dtime; /* delay time */
int tsc_dinterval; /* delay interval */
lock_t tsc_splock; /* spin lock for exclusive use */
sema_t tsc_iodone; /* sleep/wakeup semaphore */
/*
** semaphore used to insure that one processor has exclusive use
** during reads, writes and ioctls. This is done to keep the state
** info consistent because a user could do an open followed
** by a fork.
*/
sema_t tsc_mine;
int (*tsc_iomove)();/* pointer to which iomove to use */
ushort tsc_state; /* state of the device */
} tscinfo;
/*
** States for the device
*/
#define TSCS_OPEN 0x01 /* device is opened or open in progress */
#define TSCS_PROBED 0x02 /* device has been probed and found */
#define TSCS_INITED 0x04 /* device has been initialized, if not */
/* set implies intr occurred which lost*/
/* tape position */
#define TSCS_EOT 0x08 /* device has encountered EOT */
#define TSCS_FM 0x10 /* device has encountered file mark */
#define TSCS_READ 0x20 /* device opened for reading */
#define TSCS_WRITE 0x40 /* device opened for writting */
#define TSCS_REWIND 0x80 /* device is being rewound */
#define TSCS_OFFL 0x100 /* device is off-line */
#define TSCS_ERROR 0x8000 /* device had an error */
/*
** Valid Commands defined
*/
#define TS_POS_FSF_BITS 0x0200 /* mode bits for position cmd */
/* for file space forward */
#define TS_POS_FSR_BITS 0x0000 /* mode bits for position cmd */
/* for file space reverse */
#define TS_POS_REW_BITS 0x0400 /* mode bits for position cmd */
/* for rewind */
#define TS_NOP_CMD 0x0000 /* nop - pseudo-cmd */
#define TS_POS_CMD 0x0008 /* position */
#define TS_READ_CMD 0x0001 /* read data */
#define TS_WRITECR_CMD 0x0004 /* write characteristics */
#define TS_WRITE_CMD 0x0005 /* write data */
/* forward space file */
#define TS_FSF_CMD (TS_POS_CMD | TS_POS_FSF_BITS)
/* forward space record */
#define TS_FSR_CMD (TS_POS_CMD | TS_POS_FSR_BITS)
/* rewind */
#define TS_REWIND_CMD (TS_POS_CMD | TS_POS_REW_BITS)
#define TS_FORMAT_CMD 0x0009 /* format - write file mark */
#define TS_RETEN_CMD 0x000B /* retension command */
#define TS_GETST_CMD 0x000F /* get status */
#define TS_CMD_MSK 0x0F1F /* bits that commands use */
/*
** Associated command bits in the command packet
*/
#define TSCMD_ACK_BIT 0x8000 /* ack - release command packet */
#define TSCMD_1_BIT 0x4000 /* must be one */
#define TSCMD_SWB_BIT_ 0x1000 /* don't swap bytes (active low)*/
#define TSCMD_IE_BIT 0x0080 /* interrupt enable */
/*
** Associated command bits in the message packet
*/
#define TSMSG_ACK_BIT 0x8000 /* ack - if set cpu owns packet */
/*
** Bits in the tssr status register
*/
#define TSSR_SC 0x8000 /* special condition (error) */
#define TSSR_RMR 0x1000 /* register modification refused */
#define TSSR_NXM 0x0800 /* nonexistant memory */
#define TSSR_NBA 0x0400 /* need buffer address */
#define TSSR_SSR 0x0080 /* subsytem ready */
#define TSSR_OFL 0x0040 /* off-line */
/* termination codes */
#define TSSR_TC_MSK 0x000E /* termination codes */
#define TC_OK 0x0000 /* TC0: normal termination */
#define TC_ATTN 0x0002 /* TC1: attention */
#define TC_ALERT 0x0004 /* TC2: tape status alert */
#define TC_REJECT 0x0006 /* TC3: function reject */
#define TC_UNREC0 0x0008 /* TC4: unrecoverable, tape position lost*/
#define TC_UNREC1 0x000A /* TC5: unrecoverable, tape position lost*/
#define TC_UNREC2 0x000C /* TC6: unrecoverable, tape position lost*/
#define TC_FATAL 0x000E /* TC7: fatal error */
/*
** Bits in the txcpr register
*/
#define TXCPR_INIT 0x8000 /* subsystem clear */
/*
** Bits in extended status register 0 (XS0)
*/
#define XS0_TMK 0x8000 /* tape mark detected */
#define XS0_RLS 0x4000 /* record length short */
#define XS0_LET 0x2000 /* logical end of tape */
#define XS0_RLL 0x1000 /* record length long */
#define XS0_WLE 0x0800 /* write lock error */
#define XS0_NEF 0x0400 /* non-executable function */
#define XS0_ILC 0x0200 /* illegal command */
#define XS0_ILA 0x0100 /* illegal address */
#define XS0_ONL 0x0040 /* on-line */
#define XS0_IE 0x0020 /* interrupt enable status */
#define XS0_WLK 0x0004 /* write locked */
#define XS0_BOT 0x0002 /* beginning of tape */
#define XS0_EOT 0x0001 /* end of tape */
/*
** Bits in extended status register 1 (XS1)
*/
#define XS1_UNC 0x0002 /* uncorrectable data */
/*
** Bits in extended status register 3 (XS3)
*/
#define XS3_REV 0x0020 /* tape motion is reverse */
#define XS3_RIB 0x0001 /* reverse into BOT */
/*
** Bits in the characteristics mode word
*/
#define CR_ESS 0x0080 /* enable skip tape marks stop */
#define CR_ENB 0x0040 /* enable tape mark stop off BOT */
#define CR_RAW 0x0008 /* enable non-block mode */
#define CR_Q11 0x0004 /* use qic-11 mode */
#define CR_FMT 0x0002 /* enable format */
/*
** Delay times for waiting for the sub-system to come ready
** The init delay is calculated for the longest tape (600ft); this is
** because an init also causes a rewind, which we must wait to complete.
** Rewind speed: 90ips
** The formula used is:
** 1/90 * ( tape length ft * ( 12 inches per sec ) )
*/
#define DELAY_FUDGE 10 /* fudge factor for delays */
#define NO_DELAY 0
#define NO_INTERVAL 0
/*
** For an INIT delay we use the max time for a 600 foot tape
** and add in a FUDGE factor. For an INIT interval we use 1/6 the time
** for a 150 foot tape.
*/
#define INIT_DELAY ((HZ * 80) + DELAY_FUDGE)
#define INIT_INTERVAL ((HZ * 3) + DELAY_FUDGE)
/*
** For the spacing commands, the controller can handle on a ushort amount
** at a time
*/
#define MAX_POSITION_AMT 16384
#define TS_MINXFER_SZ 512 /* minumum xfer size */
/*
** Maximum xfer size. This is the maximum the driver will support via
** its internal buffer. The controller will acually support a
** 64kb xfer
*/
#define TS_MAXXFER_SZ 4096
/*
** Masks for the various bits the minor device is composed of
*/
#define CNTRLR_MSK 0x0f /* mask for controller bits */
#define REWIND_MSK 0x10 /* mask for rewind/no rewind bits */
#define SWAP_MSK 0x20 /* mask for swap bytes bit */
/*
** Macros for various bits of the minor device
*/
#define CNTRLR_DEV(dev) ((dev) & CNTRLR_MSK)
#define ISREWIND_DEV(dev) (((dev) & REWIND_MSK) == 0)
#define ISSWAP_DEV(dev) ((dev) & SWAP_MSK)
#ifdef _KERNEL
tscc tsiomove();
tscc ts_ssr();
void ts_timeout();
void tsreset();
void tswrcr();
void tsgetst();
void tsretension();
void tsformat();
void tsio();
#endif